// cart.js
Page({
  data: {
    cartItems: []
  },
  onShow: function () {
    const app = getApp()
    this.setData({
      cartItems: app.globalData.cartItems
    })
  },
  calculateTotal: function () {
    return this.data.cartItems.reduce((total, item) => total + item.price, 0)
  },
  goToCheckout: function () {
    wx.navigateTo({
      url: '/pages/profile/profile'
    })
  }
})
